#!/bin/bash
[ "$#" -ge "2" ] || { echo "usage: $0 /path/to/BitBar.app /path/to/first-plugin /path/to/second-plugin ..."; exit 1; }

codesign --deep --force --verbose --sign - "$1"

app="$1/Contents/MacOS/"

shift

# copy plugins into the app's executables directory
cp -v "$@" "$app"

# ensure they are executable
chmod -R +x "$app"
